package com.yishusmt.wechatapi.wechatdev.controller;

import com.yishusmt.wechatapi.wechatdev.dto.base.Result;
import com.yishusmt.wechatapi.wechatdev.service.SupplierService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 加工厂操作
 *
 * @author zhangyi
 * @date 2018/9/5 17:37
 */
@RestController
@RequestMapping("/supplier")
@Api(description = "加工厂信息")
@Slf4j
public class SupplierController {

    @Resource
    private SupplierService supplierService;

    /**
     * 获加工场列表
     *
     * @return
     */
    @GetMapping("/getSupplierList")
    @ApiOperation(value = "获取加工厂列表 status:(0未申请 1已经申请未审核 2审核通过 3审核未通过)",httpMethod = "GET")
    public Result getSupplierList(Integer count, Integer status){
        return supplierService.getSupplierList(count,status);
    }

    /**
     * 获取加工场详细信息
     *
     * @param id
     * @return
     */
    @GetMapping("/getSupplierInfo/{id}")
    @ApiOperation(value = "获取加工场详细信息",httpMethod = "GET")
    public Result getSupplierInfo(@PathVariable(value = "id") Long id){

        return supplierService.getSupplierInfo(id);
    }
}
